print("------------ 交集: intersection ------------")
// intersection不会改变原集合
var numbers1: Set<Int> = [1, 2, 3, 4, 5]
var numbers2: Set<Int> = [4, 5, 6, 7, 8]

print(numbers1.intersection(numbers2))
print(numbers1)

print("------------ 并集: union ------------")
print(numbers1.union(numbers2))
print(numbers1)

print("------------ 对差等分(并集后去掉共同都有的): symmetricDifference ------------")
print(numbers1.symmetricDifference(numbers2))
print(numbers1)

print("------------ 减法(从numbers1中去掉共同都有的): subtracting  ------------")
print(numbers1.subtracting(numbers2))
print(numbers1)

print("============ 判断操作 ============")
var numbers3: Set<Int> = [1, 2, 3, 4, 5, 6]
var numbers4: Set<Int> = [3, 4]
// 判断numbers4是numbers3的子集
print(numbers4.isSubset(of: numbers3))
// 判断numbers4是numbers3的严格子集(是numbers3的子集, 又不等于numbers3)
print(numbers4.isStrictSubset(of: numbers3))
// 判断numbers3是numbers4的超集
print(numbers3.isSuperset(of: numbers4))
// 判断numbers3和numbers4有没有共同元素, 有就返回false
print(numbers3.isDisjoint(with: numbers4))
